package com.wgts.wgts.mvp.presenter.imp;

import com.wgts.wgts.mvp.model.IEditPersonMessageModel;
import com.wgts.wgts.mvp.presenter.IMyCenterNikeNameActivityPresenter;
import com.wgts.wgts.mvp.view.IMyCenterNikeNameActivityView;
import com.wgts.wgts.netmodle.HttpResultSubscriber;
import com.wgts.wgts.netmodle.req.EditMyCenterMessageRequest;
import com.wgts.wgts.netmodle.resp.EditMyCenterMessageEntity;

/*
 *
 *   data:2018/9/3010:35
 *
 */public class MyCenterNikeNameActivityPresenter implements IMyCenterNikeNameActivityPresenter {
     private IMyCenterNikeNameActivityView view;
     private IEditPersonMessageModel model;
     private EditMyCenterMessageRequest request;

    public MyCenterNikeNameActivityPresenter(IMyCenterNikeNameActivityView view, IEditPersonMessageModel model) {
        this.view = view;
        this.model = model;
    }

    @Override
    public void changeNikeName(String Type, String nikeName) {
        request = new EditMyCenterMessageRequest();
        request.updateType = Type;
        request.userNickname = nikeName;
        model.editMyCenterMessageResult(request, new HttpResultSubscriber<EditMyCenterMessageEntity>() {
            @Override
            public void onSuccess(EditMyCenterMessageEntity editMyCenterMessageEntity) {
                view.changeNikeName(editMyCenterMessageEntity);
            }

            @Override
            public void _onError(int status, String msg) {
                view.onError(status, msg);
            }
        });
    }
}
